<div class="row-content layer-cf">
    <div class="row">
        <div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
            <div class="widget layer-cf">
                <div class="widget-head ">
                    <div class="widget-title layer-cf">佣金</div>
                </div>
                <div class="widget-body layui-col-sm12 layui-col-md12 layui-col-lg12">
                    <!-- 工具栏 -->
                    <div class="page_toolbar layer-margin-bottom-xs layer-cf">
                        <form id="form-search" class="layui-form" action="">
                            <div class="layui-col-sm12 layui-col-md12">
                                <div class="layer-form-group layer-fl layui-col-md3">
                                    <label class="layui-form-label">订单号：</label>
                                    <div class="layer-input-group layer-input-group-sm tpl-form-border-form">
                                        <input type="text" class="layui-input" name="order_no"
                                               placeholder="请输入订单号"
                                               value="{$request->get('order_no')}">
                                    </div>
                                </div>
                                <div class="layer-form-group layer-fl layui-col-md3">
                                    <div class="sub-lst">
                                        <button class="layui-btn layer-btn-default layer-btn-success layer-magnify" type="submit">搜索</button>
                                    </div>
                                    <div class="sub-lst">
                                        <a class="tpl-table-black layui-btn" data-id="" href="#">一键分佣</a>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>

                    <div class="layui-col-md12" >
                        <table class="layui-table">
                            <thead>
                            <tr>
                                <th>商品信息</th>
                                <th>单价/数量</th>
                                <th>实付款</th>
                                <th>买家</th>
                                <th>佣金</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {if (!$list->isEmpty())}
                            {foreach $list as $order}
                            <tr>
                                <td class="layer-text-middle layer-text-left" colspan="6" style="border-bottom:none;">
                                    <span class="layer-margin-right-lg"> {$order['create_time']}</span>
                                    <span class="layer-margin-right-lg">订单号：{$order['order_no']}</span>
                                </td>
                            </tr>
                            {foreach $order['goods'] as $i=>$goods}
                            <tr>
                                <td class="goods-detail layer-text-middle">
                                    <div class="goods-image">
                                        <img src="{$goods['image']}" alt="">
                                    </div>
                                    <div class="goods-info">
                                        <p class="goods-title">{$goods['name']}</p>
                                        <p class="goods-spec layer-link-muted">{$goods['goods_attr']}</p>
                                    </div>
                                </td>
                                <td class="layer-text-middle">
                                    <p>￥{$goods['goods_price']}</p>
                                    <p>×{$goods['total_num']}</p>
                                </td>
                                {if ($i == 0 )}
                                <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                    <p>￥{$order['pay_price']}</p>
                                    <p class="layer-link-muted">(含运费：￥{$order['express_price']})</p>
                                </td>
                                <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                    <p>{$order['user']['nickName']}</p>
                                    <p class="layer-link-muted">(用户id：{$order['user']['user_id']})</p>
                                </td>
                                <td class="layer-text-middle" rowspan="{count($order['goods'])}">
                                    {if $setting['level']>=1}
                                    <p>一层:
                                        <span class="layer-badge {$order['pay_status']['value'] === 20 ? 'layer-badge-success' : ''}">¥{$order['agent']['first'] ?? 0}</span>
                                    </p>
                                    {/if}
                                    {if $setting['level']>=2}
                                    <p>二层:
                                        <span class="layer-badge
											{$order['delivery_status']['value'] === 20 ? 'layer-badge-success' : ''}"> ¥{$order['agent']['second'] ?? 0}</span>
                                    </p>
                                    {/if}
                                    {if $setting['level']>=3}
                                    <p>三层:
                                        <span class="layer-badge
											{$order['receipt_status']['value'] === 20 ? 'layer-badge-success' : ''}"> ¥{$order['agent']['third'] ?? 0}</span>
                                    </p>
                                    {/if}
                                </td>
                                <td class="layer-text-middle  ">
                                    <a class="layui-btn tpl-table-black-operation-green" data-id="{$goods['order_id']}" href="#">分佣</a>
                                </td>
                                {/if}
                            </tr>
                            {/foreach}
                            {/foreach}
                            {else/}
                            <tr>
                                <td colspan="6" class="layer-text-center">暂无记录</td>
                            </tr>
                            {/if}
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-col-lg12 layer-cf">
                        <div class="layer-fr">{$list|raw} </div>
                        <div class="layer-fr pagination-total layer-margin-right">
                            <div class="layer-vertical-align-middle">总记录：{$list->total()}</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>

    $(function () {

        $('.tpl-table-black-operation-green')._get('order_id', "{:url('order/Sub')}",'确定要分佣吗?');
        $('.tpl-table-black')._get('order_id', "{:url('order/SubAll')}",'确定要一键分佣吗?');


    });

</script>

